import axios from "axios";

var service = axios.create({
    timeout:10 * 1000 ,
    baseURL:''
})

service.interceptors.request.use(
    (config) => {
        config.headers['Authorization'] + 'Bearer' + ' ' + localStorage.getItem('token')
        return config
    },
    (error) => {
        return Promise.reject(error)
    }
)

service.interceptors.response.use(
    (res) => { return res },
    (error) => {
        if(error.response.status == 401){
            alert(222)
        }
        return Promise.reject(error)
    }
)

export default service